
set(DIST_SOURCE  TcpClient.cpp TcpClient.hpp StoreMessagePacker.cpp StoreMessagePacker.hpp ParallelTcpServer.cpp ParallelTcpServer.hpp ParallelTcpStore.cpp ParallelTcpStore.hpp)
add_library(torch_npu SHARED ${DIST_SOURCE})
target_link_directories(torch_npu PUBLIC ${PROJECT_SOURCE_DIR}/lib)
target_link_libraries(torch_npu torch_cpu c10 pthread)

if (BUILD_PYTHON_SDK_MODULE)
    find_package(Python3 COMPONENTS Interpreter Development)
    if (Python3_FOUND)
        find_package(PythonInterp)
        if (PythonInterp_FOUND)
            find_package(pybind11 REQUIRED)
            pybind11_add_module(torch_bind ${DIST_SOURCE} dist_pybind.cpp)
            target_link_directories(torch_bind PUBLIC ${PROJECT_SOURCE_DIR}/lib)
            target_link_libraries(torch_bind PRIVATE torch_cpu c10 pthread)
        endif ()
    endif ()
endif ()